home *** CD-ROM | disk | FTP | other *** search
- class classes.shots.BlasterALaser
- {
- var id;
- var x;
- var y;
- var dir;
- var color;
- var xInc;
- var l;
- var clip;
- var startClip;
- var endClip;
- var power = 40;
- var c = 1;
- var endMessageSent = false;
- var x2 = 0;
- var Name = "blasterALaser";
- function BlasterALaser(px, py, pcolor, pdir, pid)
- {
- this.id = pid;
- this.x = px;
- this.y = py;
- this.dir = pdir;
- this.color = pcolor;
- this.xInc = this.dir != "L" ? 15 : -15;
- this.l = _root.randRange(20,40);
- _root.d = _root.d + 1;
- this.clip = _root.createEmptyMovieClip("blasterALaser" + this.id + "Clip",_root.d);
- this.clip._x = this.x;
- this.clip._y = this.y;
- _root.d = _root.d + 1;
- this.startClip = this.clip.attachMovie("blasterALaserSeg","blasterALaserSegBlastClip" + this.id,_root.d);
- this.startClip.gotoAndStop(this.color + this.dir);
- this.startClip.segment.gotoAndStop("blast");
- this.x2 += this.xInc;
- _root.d = _root.d + 1;
- this.endClip = this.clip.attachMovie("blasterALaserSeg","blasterALaserSegEndCapClip" + this.id,_root.d);
- this.endClip._x = this.x2;
- this.endClip.gotoAndStop(this.color + this.dir);
- this.endClip.segment.gotoAndStop("startCap");
- }
- function main()
- {
- this.c = this.c + 1;
- if(this.x + (this.c - 1) * this.xInc < 1150 && this.x + (this.c - 1) * this.xInc > -150)
- {
- _root.d = _root.d + 1;
- var _loc3_ = this.clip.attachMovie("blasterALaserSeg","blasterALaserSeg" + this.c + "Clip" + this.id,_root.d);
- _loc3_.gotoAndStop(this.color + this.dir);
- _loc3_.segment.gotoAndStop("mid");
- _loc3_._x = this.x2;
- this.xInc = this.dir != "L" ? 100 : -100;
- this.x2 += this.xInc;
- this.endClip._x += this.xInc;
- }
- if(this.c > this.l)
- {
- if(!this.endMessageSent)
- {
- _root["blasterA" + this.id].stopBlast();
- this.endMessageSent = true;
- this.startClip.segment.gotoAndStop("endCap");
- }
- removeMovieClip(this.clip["blasterALaserSeg" + (this.c - this.l) + "Clip" + this.id]);
- this.startClip._x += this.xInc;
- }
- if(_root["blasterA" + this.id].f2 == "blasting")
- {
- this.clip._x = this.dir != "L" ? _root["blasterA" + this.id].x + 39 : _root["blasterA" + this.id].x;
- this.clip._y = _root["blasterA" + this.id].y;
- }
- if(this.clip.hitTest(_root[_root.char + "Clip"]))
- {
- _root[_root.char].hit(this.xInc / 2,0,100,this.power);
- }
- if(this.c > 3 && Math.abs(this.endClip._x - this.startClip._x) < 100)
- {
- _root.removeEnemyShot("blasterALaser" + this.id);
- }
- }
- }
-